﻿using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using MonoGame.Extended.VectorDraw;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MonoGame.Extended.ViewportAdapters;
using MonoGame.Extended;

namespace MonoEarth.GISExtensions
{
    public   class GISHelper
    {
        private static Dictionary<MouseStateEnum, Action<SceenPosition>> GISDrawDic = new Dictionary<MouseStateEnum, Action<SceenPosition>>();



        private PrimitiveDrawing _primitiveDrawing;
        private PrimitiveBatch _primitiveBatch;
        private Matrix _localProjection;
        private Matrix _localView;
        private readonly GameEarth _game;
        private bool _isInitialized;
        private SpriteBatch _spriteBatch;


        private GameWindow Window => _game.Window;
        private GraphicsDevice GraphicsDevice => _game.GraphicsDevice;
        private GameComponentCollection Components => _game.Components;
        private OrthographicCamera Camera { get;  set; }
        private ViewportAdapter ViewportAdapter { get;  set; }

        public GISHelper(GameEarth game)
        {
            GISDrawDic.Add(MouseStateEnum.Point, Draw_Point);
            GISDrawDic.Add(MouseStateEnum.Line, Draw_Line);
            GISDrawDic.Add(MouseStateEnum.Rectangle, Draw_Rectangle);
            GISDrawDic.Add(MouseStateEnum.Polygon, Draw_Polygon);
            GISDrawDic.Add(MouseStateEnum.Circle, Draw_Circle);
            GISDrawDic.Add(MouseStateEnum.Ellipse, Draw_Ellipse);
            GISDrawDic.Add(MouseStateEnum.Curves, Draw_Curves);
            GISDrawDic.Add(MouseStateEnum.Multiline, Draw_Multiline);
            GISDrawDic.Add(MouseStateEnum.EnclosedRegion, Draw_EnclosedRegion);
            GISDrawDic.Add(MouseStateEnum.Arc, Draw_Arc);
            GISDrawDic.Add(MouseStateEnum.Pie, Draw_Pie);
            GISDrawDic.Add(MouseStateEnum.Angle, Draw_Angle);
            GISDrawDic.Add(MouseStateEnum.Image, Draw_Image);
            GISDrawDic.Add(MouseStateEnum.Text, Draw_Text);

            _game = game;


            _spriteBatch = new SpriteBatch(GraphicsDevice);
            _primitiveBatch = new PrimitiveBatch(GraphicsDevice);
            _primitiveDrawing = new PrimitiveDrawing(_primitiveBatch);
            _localProjection = Matrix.CreateOrthographicOffCenter(0f, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0f, 0f, 1f);
            _localView = Matrix.Identity;
            ViewportAdapter = _game.ViewportAdapter;
            Camera = new OrthographicCamera(ViewportAdapter);





        }

        public  void Draw(params SceenPosition[] positions)
        {

        }


      
        public  void Draw_Point(SceenPosition  point)
        {

        }

        public  void Draw_Line(SceenPosition line)
        {

        }

        public  void Draw_Rectangle(SceenPosition rectangle)
        {

        }

        public void Draw_Polygon(SceenPosition polygon)
        {

        }

        public void Draw_Circle(SceenPosition circle)
        {

        }


        public void Draw_Ellipse(SceenPosition ellipse)
        {

        }

        public void Draw_Curves(SceenPosition curves)
        {

        }

        public void Draw_Multiline(SceenPosition multiline)
        {

        }

        public void Draw_EnclosedRegion(SceenPosition enclosedRegion)
        {

        }

        public void Draw_Arc(SceenPosition arc)
        {

        }

        public void Draw_Pie(SceenPosition pie)
        {

        }
        public void Draw_Angle(SceenPosition angle)
        {

        }
        public void Draw_Image(SceenPosition image)
        {

        }

        public void Draw_Text(SceenPosition text)
        {

        }







    }
}
